* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    background: #faf8ef;
    color: #776e65;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 500px;
    margin: 0 auto;
    padding: 15px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 80px;
    font-weight: bold;
    margin: 0;
    color: #776e65;
}

.scores-container {
    display: flex;
    gap: 10px;
}

.score-box {
    background: #bbada0;
    padding: 10px 20px;
    border-radius: 3px;
    color: white;
    text-align: center;
    min-width: 100px;
}

.score-label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
}

.score-box span:last-child {
    display: block;
    font-size: 25px;
    font-weight: bold;
}

.game-info {
    margin-bottom: 20px;
    text-align: center;
}

#new-game-btn {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
}

#new-game-btn:hover {
    background: #7f6a56;
}

.game-explanation {
    font-size: 14px;
    line-height: 1.5;
}

.game-container {
    position: relative;
    background: #bbada0;
    padding: 15px;
    border-radius: 6px;
    width: 500px;
    height: 500px;
    margin: 0 auto;
}

.game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.73);
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: fade-in 800ms ease;
}

.game-message.game-over {
    display: flex;
}

.game-message p {
    font-size: 60px;
    font-weight: bold;
    margin-bottom: 30px;
}

#retry-btn {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

#retry-btn:hover {
    background: #7f6a56;
}

.grid-container {
    position: absolute;
    z-index: 1;
}

.grid-row {
    display: flex;
    margin-bottom: 15px;
}

.grid-row:last-child {
    margin-bottom: 0;
}

.grid-cell {
    width: 106.25px;
    height: 106.25px;
    margin-right: 15px;
    background: rgba(238, 228, 218, 0.35);
    border-radius: 3px;
}

.grid-cell:last-child {
    margin-right: 0;
}

.tile-container {
    position: absolute;
    z-index: 2;
}

.tile {
    position: absolute;
    width: 106.25px;
    height: 106.25px;
    border-radius: 3px;
    font-size: 55px;
    font-weight: bold;
    line-height: 106.25px;
    text-align: center;
    transition: 100ms ease-in-out;
    transition-property: transform;
}

.tile.tile-2 {
    background: #eee4da;
    color: #776e65;
}

.tile.tile-4 {
    background: #ede0c8;
    color: #776e65;
}

.tile.tile-8 {
    background: #f2b179;
    color: #f9f6f2;
}

.tile.tile-16 {
    background: #f59563;
    color: #f9f6f2;
}

.tile.tile-32 {
    background: #f67c5f;
    color: #f9f6f2;
}

.tile.tile-64 {
    background: #f65e3b;
    color: #f9f6f2;
}

.tile.tile-128 {
    background: #edcf72;
    color: #f9f6f2;
    font-size: 45px;
}

.tile.tile-256 {
    background: #edcc61;
    color: #f9f6f2;
    font-size: 45px;
}

.tile.tile-512 {
    background: #edc850;
    color: #f9f6f2;
    font-size: 45px;
}

.tile.tile-1024 {
    background: #edc53f;
    color: #f9f6f2;
    font-size: 35px;
}

.tile.tile-2048 {
    background: #edc22e;
    color: #f9f6f2;
    font-size: 35px;
}

.tile.tile-super {
    background: #3c3a32;
    color: #f9f6f2;
    font-size: 30px;
}

.tile-new {
    animation: appear 200ms ease;
}

.tile-merged {
    z-index: 20;
    animation: pop 200ms ease;
}

@keyframes appear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* 响应式设计 */
@media screen and (max-width: 520px) {
    .container {
        width: 100%;
        padding: 10px;
    }
    
    .game-container {
        width: 100%;
        height: 400px;
        padding: 10px;
    }
    
    .grid-cell,
    .tile {
        width: 80px;
        height: 80px;
        line-height: 80px;
        font-size: 40px;
    }
    
    .tile.tile-128,
    .tile.tile-256,
    .tile.tile-512 {
        font-size: 35px;
    }
    
    .tile.tile-1024,
    .tile.tile-2048 {
        font-size: 25px;
    }
    
    h1 {
        font-size: 50px;
    }
} 